
import 'dart:io';

import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:share_fit/app/helper/ext/tr_ext.dart';
import 'package:share_fit/generated/locales.g.dart';

class DeviceUnbindUtils {

  static void showUnbindSuccessDialog() {
    if (Get.overlayContext != null) {
      showDialog(
          context: Get.overlayContext!,
          barrierDismissible: Platform.isIOS,
          builder: (dlgContext) {
            return _buildUnbindSuccessDialog(dlgContext);
          });
    }
  }

  static Widget _buildUnbindSuccessDialog(BuildContext context) {
    return Material(
      type: MaterialType.transparency,
      child: Center(
        child: SizedBox(
          width: 916.w,
          height: 736.w,
          child: Container(
            decoration: const ShapeDecoration(
              color: Color(0xffffffff),
              shape: RoundedRectangleBorder(
                borderRadius: BorderRadius.all(
                  Radius.circular(20.0),
                ),
              ),
            ),
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              crossAxisAlignment: CrossAxisAlignment.center,
              children: [
                Image.asset('assets/images/device/device_dialog_success.png',
                    width: 222.w, height: 222.h),
                SizedBox(height: 34.h),
                Text(LocaleKeys.device_unbind_message.ts,
                    style: TextStyle(fontSize: 54.sp)),
                SizedBox(height: 60.h),
              ],
            ),
          ),
        ),
      ),
    );
  }

  static void dismissUnbindSuccessDialog() {
    if (Get.overlayContext != null) {
      Navigator.of(Get.overlayContext!, rootNavigator: true).pop();
    }
  }
}